<?php /*a:4:{s:60:"/www/wwwroot/yinglinet.cn/app/admin/view/order/orderlst.html";i:1711604064;s:57:"/www/wwwroot/yinglinet.cn/app/admin/view/base/header.html";i:1699343568;s:57:"/www/wwwroot/yinglinet.cn/app/admin/view/base/footer.html";i:1699343568;s:57:"/www/wwwroot/yinglinet.cn/app/admin/view/base/unitjs.html";i:1699343568;}*/ ?>
<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>项目</title>
    <link rel="stylesheet" href="/static/component/pear/css/pear.css">
    <link rel="stylesheet" href="/static/component/code/css/style.css">
        <script src="/static/user/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/component/layui/layui.js"></script>
    <script src="/static/component/pear/pear.js"></script>
</head>

<body class="pear-container">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form" action="" id="formSearchId">
                    <div class="layui-form-item">
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label">查询用户</label>
                            <div class="layui-input-inline">
                                <input type="text" name="umsg" placeholder="" class="layui-input">
                            </div>
                        </div>
                        
                        <div class="layui-form-item  layui-inline">
                            <label class="layui-form-label" style="width: 100px;">开始时间</label>
                            <div class="layui-input-inline">
                             <input type="text" id="start_time" name="time1" autocomplete="off" placeholder="请输入开始时间" value="" class="layui-input">
                            </div>
                        </div>
            
                        <div class="layui-form-item  layui-inline">
                            <label class="layui-form-label" style="width: 100px;">截止时间</label>
                            <div class="layui-input-inline">
                                <input type="text" id="end_time" name="time2" value="" autocomplete="off" placeholder="请输入截止时间" class="layui-input">
                            </div>
                        </div>

                           <div class="layui-form-item layui-inline">
                            <label class="layui-form-label">是否退款</label>
                            <div class="layui-input-inline">
                                <select name="is_staff">
                                    <option value="">请选择类型</option>
                                    <option value="0">未退款</option>
                                    <option value="1">已退款</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label">域名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="admin" placeholder="" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-inline">
                            <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
                                <i class="layui-icon layui-icon-search"></i>
                                查询
                            </button>
                            <button type="reset" class="pear-btn pear-btn-md">
                                <i class="layui-icon layui-icon-refresh"></i>
                                重置
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>

        <div class="layui-card">
            <div class="layui-card-body">
                <table id="tableId" lay-filter="user-table"></table>
            </div>
        </div>
        <script type="text/html" id="user-usermsg">
            <!-- <img src="{{d.umsg.head_img}}" class="layui-nav-img">
            <span>{{d.umsg.nickname}}
            </span> -->
            {{#if (d.umsg.mobile ) { }}
                <span>{{d.umsg.mobile}}</span>
            {{# } }}
        </script>
        
        <script type="text/html" id="user-type">
            {{#if (d.is_tk==0 ) { }}
            {{#if (d.status ) { }}
                    <span class="layui-badge layui-bg-black">已付款</span>
                {{# }else{ }}
                    <span class="layui-badge layui-bg-blue">未付款</span>
                {{# } }}
            {{# }else{ }}
            
             <span class="layui-badge layui-bg-blue">已退款</span>
                
         {{# } }}
        </script>
 
        
       
        <script type="text/html" id="user-set">
                    <button class="pear-btn pear-btn-warming pear-btn-xs" lay-event="showOrderdetails">订单详情</button>
                    {{#if (d.is_tk==0 ) { }}
                        <button class="pear-btn pear-btn-danger pear-btn-xs" lay-event="sendOrderTk">退款</button>
                    {{# } }}
        </script>
        <script>
			layui.use(['table', 'form', 'jquery','common','laydate'], function() {
				let table = layui.table;
				let form = layui.form;
				let $ = layui.jquery;
				let common = layui.common;
                let laydate = layui.laydate;
                var endDate= laydate.render({
                elem: '#end_time',//选择器结束时间
                type: 'datetime',
                min:"1970-1-1",//设置min默认最小值
                done: function(value,date){
                    $('#end_time').change(); 
                    startDate.config.max={
                        year:date.year,
                        month:date.month-1,//关键
                        date: date.date,
                        hours: 0,
                        minutes: 0,
                        seconds : 0
                    }
                }
            });
	//日期范围
	var startDate=laydate.render({
		elem: '#start_time',
		type: 'datetime',
		max:"2099-12-31",//设置一个默认最大值
		done: function(value, date){
		    $('#start_time').change(); 
			endDate.config.min ={
				year:date.year,
				month:date.month-1, //关键
				date: date.date,
				hours: 0,
				minutes: 0,
				seconds : 0
			};
		}
	});
                let cols = [
                    [{
                        title: '查询单号',
                        field: 'sn',
                        align: 'left',
                        width: 150
                    },
                    {
                            title: '检测时间',
                            field: 'addtime',
                            align: 'left',
                            width: 150,
                        },
                    {
                            title: '姓名',
                            field: 'reaname',
                            align: 'left',
                            width: 120,
                        },
                        {
                            title: '身份证号',
                            field: 'idcard',
                            align: 'left',
                            width: 180,
                        },
                        {
                            title: '信用级别',
                            field: 'res_1',
                            align: 'center',
                            width: 120,
                        },
                        // {
                        //     title: '通过率',
                        //     field: 'res_2',
                        //     align: 'center',
                        //     width: 120,
                        // },
                   
                    {
                        title: '状态',
                        field: 'search_type',
                        align: 'center',
                        templet: '#user-type',
                        width: 120,
                    },
                    {
                        title: '订单金额（￥）',
                        field: 'price',
                        align: 'center',
                        width: 150,
                    },
                    {
                        title: '付款时间',
                        field: 'paytime',
                        align: 'left',
                        width: 120,
                    },
                    {
                        title: '退款时间',
                        field: 'tktime',
                        align: 'left',
                        width: 120,
                    },
                     {
                        title: 'doadmin',
                        field: 'admin',
                        align: 'left',
                        width: 240,
                    },
                    {
                        title: '查询用户',
                        align: 'center',
                        templet: '#user-usermsg',
                         width: 120,
                    },
               
                    {
                        title: '操作',
                        toolbar: '#user-set',
                        align: 'left',
                        width: 200,
                        fixed:"right"
                    }
                    ]
                ];
                table.render({
                    elem: '#tableId',
                    url: "<?php echo url('order/orderlst'); ?>",
                    page: true,
                    cols: cols,
                    skin: 'line',
                    toolbar: '#user-toolbar',
                    defaultToolbar: [{
                        title: '刷新',
                        icon: 'layui-icon-refresh',
                        layEvent: 'refresh',
                    }, 'filter',  'exports']
                });
               table.on('tool(user-table)', function (obj) {
                    if (obj.event === 'showOrderdetails') {
                        window.showOrderdetails(obj.data);
                    
                        return;
                    }
                    if(obj.event==='sendOrderTk'){
                          var id=obj.data.id;
                            layer.confirm('确定要退款该订单->'+obj.data.sn, {
                                icon: 3,
                                title: '提示'
                            }, function (index) {
                                layer.close(index);
                                loading=layer.load();
                                postData("<?php echo url('order/ordertk'); ?>",{id:obj.data.id}).then(function(res){
                                   layer.close(loading);
                             
                                    if(res.code==200){
                                        layer.msg(res.message, {
                                            icon: 1,
                                            time: 1000
                                        }, function () {
                                            	table.reload('tableId');
                                        });
                                        return;
                                    }
                                    layer.msg(res.message, {
                                        icon: 2,
                                        time: 1000
                                    });
                                });
                            });
                        return;
                    }
                
                });
              
                table.on('toolbar(user-table)', function (obj) {
                    if (obj.event === 'refresh') {
						window.refresh();
					}else if(obj.event==='exceldown'){
                        window.exceldown();
                    }
                });
                window.exceldown=function(){
                    var data=$("#formSearchId");
                        postDatai("<?php echo url('order/downExcel'); ?>", data,"数据封装中").then(function (res) {
                        if (res.code == 200) {
                            window.open(res.data.path);
                        } else {
                            layer.msg(res.message, {
                                icon: 2,
                                time: 1000
                            });
                        }
                    });
                } 
                window.refresh = function(param) {
					table.reload('tableId');
				}

                window.showOrderdetails = function (data) {
                    layer.open({
                        type: 2,
                        title: `单号${data.sn}`,
                        shade: 0.1,
                        area: ['90%', '700px'],
                        content: "<?php echo url('order/orderdetails'); ?>?id="+data.id
                    });
                }
               
         
                form.on('submit(user-query)', function (data) {
                    table.reload('tableId', {
                        page: {curr: 1 },
                        where: data.field
                    })
                    return false;
                });
              

			})
            var layer_tips = 0;

 $(document).on('mouseenter', '#downId', function () {

    
    layer_tips = layer.tips('导出数据为 当前筛选条件 所查询的所有数据', '#downId', {

          time: 0,

          tips: 2

        });

      }).on('mouseleave', '#downId', function () {

        layer.close(layer_tips);

      });

         
		</script>
</body>

<script>








    //     参数解释  
    //  url 地址  
    //  data  数据  
    //  alt 进度提示内容  
    //  ins 0 手动处理返回信息  1 自动处理返回信息
    //     co[辅助alt  co = 0时  进度条默认关闭  co = 1时  手动关闭进度条及之后弹框的内容]


    //带文件提交
    function postDatai(url, form, alt = "", ins = 0) {
        var p = new Promise(function (resolve, reject) {
            var formData = new FormData(form[0]);
            $.ajax({
                url: url,
                type: 'POST',
                data: formData,
                dataType: 'json',
                async: true,
                processData: false,
                contentType: false,
                success: function (res) {
                    if (res.code == -1) {
                        layer.alert(res.msg, {
                            title: "提示",
                            closeBtn: 0,
                            yes: function () {
                                location.reload();
                            }
                        });
                        return;
                    }
                    if (!ins) {
                        resolve(res);
                        return;
                    }
                    layer.alert(res.msg, {
                        title: "提示",
                        closeBtn: 0,
                        yes: function () {
                            res.code == 200 ? location.reload() : layer.close(layer.index);
                            return;
                        }
                    });


                },
                error: function (e) {
                    var res = $.parseJSON(e.responseText);
                    layer.alert(res.message, {
                        title: '提示',
                        closeBtn: 0,
                    });
                },
                beforeSend: function () {
                    if (alt) {
                        layer.msg(alt, { icon: 16, shade: 0.4, time: false });
                    }

                },
                complete: function () {
                    if (alt) {
                        layer.close(layer.index);
                    }
                }

            });
        })
        return p;
    }




    //普通提交--整改
    function postData(url, data, alt = "", ins = 0, co = 0) {
        var p = new Promise(function (resolve, reject) {
            $.ajax({
                url: url,
                data: data,
                header: { 'content-type': 'application/json' },
                type: 'POST',
                dataType: 'json',
                responseType: 'text',
                success: function (res) {
                    if (res.code == -1) {
                        layer.alert(res.message, {
                            title: "提示",
                            closeBtn: 0,
                            yes: function () {
                                location.reload();
                            }
                        });
                        return;
                    }
                    if (!ins) {
                        resolve(res);
                        return;
                    }
                    layer.alert(res.message, {
                        title: "提示",
                        closeBtn: 0,
                        yes: function () {
                            res.code == 200 ? location.reload() : layer.close(layer.index);
                            return;
                        }
                    });
                },
                fail: function (res) {
                    console.log(res);

                },
                error: function (e) {
                    var res = $.parseJSON(e.responseText);
                    layer.alert(res.message, {
                        title: '提示',
                        closeBtn: 0,
                    });
                },
                beforeSend: function () {
                    if (alt) {
                        layer.msg(alt, { icon: 16, shade: 0.4, time: false });
                    }

                },
                complete: function () {
                    if (alt && co) {
                        layer.close(layer.index);
                    }
                }

            })

        })
        return p;
    }



    function getObjectURL(file) {
		var url = null;
		if (window.createObjectURL != undefined) { // basic
			url = window.createObjectURL(file);
		} else if (window.URL != undefined) { // mozilla(firefox)
			url = window.URL.createObjectURL(file);
		} else if (window.webkitURL != undefined) { // webkit or chrome
			url = window.webkitURL.createObjectURL(file);
		}
		return url;
	}
</script>

</html>